﻿@using Movi.Model
@using Movi.Model.Enums

@{

    var headerMenu = new List<List<string>>()
    {
        new List<string>() {"电影", "Index", "Media", MediaType.Movie.ToString()},
        new List<string>() {"动漫", "Index", "Media",MediaType.Cartoon.ToString()},
        new List<string>() {"电视剧", "Index", "Media",MediaType.Teleplay.ToString()}
    };

    var urlRequest = Request.QueryString;
    var mediaType = urlRequest["mtype"];
    if (ViewData["MediaType"] != null)
    {
        mediaType = ViewData["MediaType"].ToString();
    }

    var siteConfig = ViewData["SiteConfig"] as SiteConfig;
    var logoUrl = "/Content/Images/Logo.png";
    if (siteConfig != null)
    {
        logoUrl = siteConfig.SiteLogo;
    }
}

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button mtype="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/" id="logo">
                <img src="@Url.Content(logoUrl)" alt="" />
            </a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav" id="navmenu">
                @{
                    if (headerMenu != null && headerMenu.Any())
                    {
                        foreach (var menu in headerMenu)
                        {
                    <li @if (mediaType.Equals(menu[3], StringComparison.OrdinalIgnoreCase))
                        { 
                                    <text>
                                        class="active"
                                    </text>  }>
                        @Html.ActionLink(menu[0], menu[1], menu[2], new { mtype = menu[3] },null)
                    </li>
                        }
                    }
                }
            </ul>
        </div>
    </div>
</nav>
